﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using DAL;
using Common;

namespace UI.system.page.storage
{
    public partial class jiepianadd : System.Web.UI.Page
    {
        public RukuInfo rkinfo = new RukuInfo();
        public JiepianInfo jpinfo = new JiepianInfo();
        public HuanpianInfo hpinfo = new HuanpianInfo();
        public string[] imgs;
        public string Imgs = string.Empty;
        public List<PositionInfo> positionlist = new List<PositionInfo>();
        public string aname;
        protected void Page_Load(object sender, EventArgs e)
        {
            positionlist = PositionDAL.FindAll();
            Imgs = "0";
            string id = JobRequest.GetRequestString("id");
            string ucode = JobRequest.GetRequestString("ucode");

            if (HuanpianDAL.FindCount(ucode, id) > 0)
            {
                hpinfo = HuanpianDAL.FindOneByUCodeAndNumber(ucode, id);
                jpinfo.AName = hpinfo.AName;
                jpinfo.BPCount = hpinfo.BPCount;
                jpinfo.CreateDate = hpinfo.CreateDate;
                jpinfo.Imgs = hpinfo.Imgs;
                jpinfo.LKCount = hpinfo.LKCount;
                jpinfo.UCode = hpinfo.UCode;
                jpinfo.PID = hpinfo.PID;
                jpinfo.PIDText = hpinfo.PIDText;
                jpinfo.Remarks = hpinfo.Remarks;
                jpinfo.NumBer = hpinfo.NumBer;
                jpinfo.JPName = hpinfo.HPName;
                jpinfo.Mobile = hpinfo.Mobile;
                
            }
            else 
            {
                rkinfo = RukuDAL.FindOneByUCodeAndNumber(ucode, id);
                jpinfo.AName = rkinfo.AName;
                jpinfo.BPCount = rkinfo.BPCount;
                jpinfo.CreateDate = rkinfo.CreateDate;
                jpinfo.Imgs = rkinfo.Imgs;
                jpinfo.LKCount = rkinfo.LKCount;
                jpinfo.UCode = rkinfo.UCode;
                jpinfo.PID = rkinfo.PID;
                jpinfo.PIDText = rkinfo.PIDText;
                jpinfo.Remarks = rkinfo.Remarks;
                jpinfo.NumBer = rkinfo.NumBer;                
                
            }
            

                //info = ProductDAL.FindOneByID(id);
                //if (info.Imgs != "" && info.Imgs != null)
                //{
                //    imgs = info.Imgs.Split(',');
                //    Imgs = SerializeHelper.ToJsonByDynamic(imgs);
                //}

            if (B.MyAdmin != null)
            {
                aname = B.MyAdmin.RealName;
            }
        }
    }
}